<?php
class PNUserHotelAllotmentArray extends PNObjectArray {
  function PNUserHotelAllotmentArray($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'hotelbooking_hotelallotment';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';
    
    $this->_objJoin[] = array ( 'join_table' => 'hotelbooking_hotelmember',
                                'compare_field_table' => 'hotelMember_id',
                                'compare_field_join' => 'id',
                                'join_field' => array('id', 'hotelName','description','accommodation','facilities','restaurant','contactus','other','latitude','longitude'),
                                'object_field_name' => array('member_id', 'member_hotelName', 'member_description', 'member_accommodation','member_facilities','member_restaurant','member_contactus','member_other','member_latitude','member_longitude')
                        );
                        
    $this->_objJoin[] = array ( 'join_table' => 'hotelbooking_hotelmember',
                                'compare_field_table' => 'hotelMember_id',
                                'compare_field_join' => 'id',
                                'join_field' => array('id', 'hotelName','description','accommodation','facilities','restaurant','contactus','other','latitude','longitude'),
                                'object_field_name' => array('member_id', 'member_hotelName', 'member_description', 'member_accommodation','member_facilities','member_restaurant','member_contactus','member_other','member_latitude','member_longitude')
                        );
    
    
    
    
    $this->_init($init, $where);
  }

  function genFilter(){
    $hotelid = FormUtil::getPassedValue('hotelid',FALSE);
    
    if($hotelid){
      $wheres[] = $this->_columns['hotelMember_id']."  = ".$hotelid;
    }
    if(count($wheres)>1){
      $where = implode(" AND ",$wheres);
    }else{
      $where = $wheres[0];
    }
    
    return $where;
  }
  function genForward()
  {
    return pnModUrl("hotelbooking","user","listallotment");
  }
}